home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / GMS / Source / C / Screens / OBJScreen.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-04  |  1.4 KB  |  54 lines

  1. /*
  2. ** Object Demo
  3. ** -----------
  4. ** Opens a screen according to the settings in an object file.  See
  5. ** asm/UsingObjects/OBJScreen.s for the object definitions.
  6. **
  7. ** To compile with SAS/C:
  8. **
  9. **   1> sc OBJScreen.c link startup=LIB:gms.o data=far
  10. **
  11. */
  12.  
  13. #include <proto/games.h>
  14.  
  15. extern struct GMSBase *GMSBase;
  16. ULONG  _XCEXIT = NULL;
  17. ULONG  PREFSNAME = DEFAULT;
  18.  
  19. void main(void)
  20. {
  21.   struct GameScreen *GameScreen;
  22.   struct Picture *Picture;
  23.   APTR OBJBase;
  24.  
  25.   if (OBJBase = LoadObjectFile("GMS:demos/data/OBJ.Screen")) {
  26.    if (Picture = GetObject(OBJBase,"Picture")) {
  27.     if (LoadPic(Picture)) {
  28.      if (GameScreen = (struct GameScreen *) GetScreen()) {
  29.         GameScreen->MemPtr1 =    Picture->Data;
  30.         GameScreen->ScrWidth =   Picture->Width;
  31.         GameScreen->ScrHeight =  Picture->Height;
  32.         GameScreen->PicWidth =   Picture->Width;
  33.         GameScreen->PicHeight =  Picture->Height;
  34.         GameScreen->Planes =     Picture->Planes;
  35.         GameScreen->AmtColours = Picture->AmtColours;
  36.         GameScreen->ScrMode =    Picture->ScrMode;
  37.         GameScreen->ScrType =    Picture->ScrType;
  38.         GameScreen->Palette =    Picture->Palette;
  39.         GameScreen->Attrib =     CENTRE;
  40.  
  41.         if (AddScreen(GameScreen)) {
  42.            ShowScreen(GameScreen);
  43.            WaitLMB();
  44.         }
  45.      DeleteScreen(GameScreen);
  46.      }
  47.     FreePic(Picture);
  48.     }
  49.    }
  50.   FreeObjectFile(OBJBase);
  51.   }
  52. }
  53.  
  54.